package com.remoting.api.request.support;

import com.remoting.api.registry.bean.HostInfo;
import com.remoting.api.registry.bean.ServiceImportInfo;
import com.remoting.api.request.RequestHandler;

import java.util.Map;


/**
 * http请求
 * <p>说明:</p>
 * <li></li>
 * @author DuanYong
 * @since 2018年12月27日上午10:53:29
 */
public class RemoteRequest {
	/**
	 * 请求处理器
	 */
	private RequestHandler requestHandler;
	/**
	 * 服务信息
	 */
	private ServiceImportInfo serviceImportInfo;
	/**
	 * 参数信息
	 */
	private Map<String,Object> params;
	/**
	 * 请求地址
	 */
	private String address;
	
	public RemoteRequest(){}
	
	public RemoteRequest(RequestHandler requestHandler,ServiceImportInfo serviceImportInfo, Map<String, Object> params) {
		super();
		this.requestHandler = requestHandler;
		this.serviceImportInfo = serviceImportInfo;
		this.params = params;
	}

	public RequestHandler getRequestHandler() {
		return requestHandler;
	}

	public void setRequestHandler(RequestHandler requestHandler) {
		this.requestHandler = requestHandler;
	}

	public ServiceImportInfo getServiceImportInfo() {
		return serviceImportInfo;
	}
	public void setServiceImportInfo(ServiceImportInfo serviceImportInfo) {
		this.serviceImportInfo = serviceImportInfo;
	}
	public Map<String, Object> getParams() {
		return params;
	}
	public void setParams(Map<String, Object> params) {
		this.params = params;
	}
	
	
	public String getAddress(){
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * 构建get请求对象
	 * <p>说明:</p>
	 * <li></li>
	 * @author DuanYong
	 * @param host 主机信息
	 * @return get请求对象
	 * @since 2018年12月27日下午5:19:02
	 */
	public GetRequest builderGetRequest(HostInfo host){
		return new GetRequest(requestHandler,serviceImportInfo,params).doBuilder(host);
	}
    /**
     * 构建post请求对象
     * <p>说明:</p>
     * <li></li>
     * @author DuanYong
     * @param host 主机信息
     * @return post请求对象
     * @since 2018年12月27日下午5:19:46
     */
	public PostRequest builderPostRequest(HostInfo host){
		return new PostRequest(requestHandler,serviceImportInfo,params).doBuilder(host);
	}
	

}
